<?php require './view/public/header.php'; ?>
    <!--/sidebar-->
    <div class="main-wrap">
        <div class="result-wrap">
            <form name="myform" id="myform" method="post">
                <div class="result-content">
                    <table class="result-tab" width="100%">
                        <tr>
                            <th>ID</th>
                            <th>类别名称</th>
                            <th>父ID</th>
                            <th>PATH</th>
                            <th>操作</th>
                        </tr>
						<?php
							if(!$ret)die;
							$color = $spl = '';
							foreach($ret as $v){
								$num = substr_count($v['path'],'-');
								if($num!=0){$spl = str_repeat('____',$num-1);}
								if($num==1){
									$color='#e50150';
								}elseif($num==2){
									$color='#f99406';
								}elseif($num==3){
									$color='ppink';
								}elseif($num==4){
									$color='deeppink';
								}elseif($num==5){
									$color='yellow';
								}
								echo '<tr>';
									echo '<td>'.$v['tid'].'</td>';
									echo "<td style='color:$color'>$spl$v[tname]</td>";
									echo '<td>'.$v['pid'].'</td>';
									echo '<td>'.$v['path'].'</td>';
									echo "<td><a class='link-update' href='./index.php?c=type&a=edit&tname=$v[tname]&id=$v[tid]&path=$v[path]'>修改</a> <a onclick=\"return confirm('确定要删除吗?')\" class='link-del' href='./index.php?c=type&a=del&id=$v[tid]'>删除</a> <a class='link-update' href='./index.php?c=type&a=addFrom&id=$v[tid]&path=$v[path]&tname=$v[tname]'>添加子类</a></td>";
								echo '</tr>';
							}
						?>
                    </table>
                </div>
            </form>
        </div>
    </div>
    <!--/main-->
<?php require './view/public/footer.php'; ?>